package auth_middleware

import (
	"fmt"

	"github.com/kataras/iris/v12"
)

func AuthMiddleware(c iris.Context) {
	token := c.GetHeader("token")
	if token == "" {
		c.StatusCode(iris.StatusUnauthorized)
		c.JSON(iris.Map{
			"code":    401,
			"message": "token is empty",
		})
		return
	}
	fmt.Println("token:", token)
	c.Next()
}
